<?php
if(!defined('BZ_XTBLOG') || !defined('BZ_WJSCUZ')) {
	exit('Access Denied');
}
$fid =verify_id($_GET['fid']);
$wzxx_title ='论坛首页-'.$wzxx_title.'';
$wzxx_gj    ='论坛首页-'.$wzxx_gj.'';
$wzxx_ms    ='论坛首页-'.$wzxx_ms.'';

     $sqla=$db->query('forum'," `sz_sc` ='0' ORDER BY `id` DESC LIMIT 0 , 5",'');
     $sjts='';
     while($rowc=mysql_fetch_array($sqla)){
	     	$dmt['name'] =Bingz_html($rowc['name']);
	    	$dmtname =mb_substr($dmt['name'],0,15,"utf-8");
	    	$sjts=date('m/d',$rowc['time_b']);
	      $forumtz[]= array('sj' => $sjts,'id' => $rowc['id'],'name' => $dmtname,'cks' => $rowc['cks'],'hfs' => $rowc['hfs']);
     }

if($fid){
   $sql_fi=$db->query('forum_class_fl',"`id` = '$_GET[fid]' ORDER BY `px`",'');
   while($aaw=mysql_fetch_array($sql_fi)){
        $sql_li=$db->query('forum_class'," `fid` = '$aaw[id]' and `type` = '1' ORDER BY `px`",'');
        $acc='';
        while($row_c=mysql_fetch_array($sql_li)){
	             if($row_c[logo] == '0' ){
	             	  if($row_c[tzszj] > 0 ){
	       	             $logo="images/forum/forum_new.gif";
	             	  }else{
	       	             $logo="images/forum/forum.gif";
	             	  }
	             }else{
	             	  $logo="$row_c[logo]";
	             }
	             $forum=$db->get_one('forum'," `cid` ='$row_c[id]'  ORDER BY `time_b` DESC LIMIT 0 , 1 ",'id,name');
				       $forum[name]=Bingz_html($forum[name]);      
               $forum[name]=mb_substr($forum[name],0,13,"utf-8");
	             $acc[]= array("logo"=>"$logo","namej"=>"$row_c[value]","id"=>"$row_c[id]","name"=>"$row_c[name]","tzsz"=>"$row_c[tzsz]","hfsj"=>"$row_c[tzszj]","tzsh"=>"$row_c[tzsh]","tzst"=>"$row_c[tzst]","forumid"=>"$forum[id]","forumname"=>"$forum[name]");
        }
	      $forulb[]= array("flid"=>"$aaw[id]","flname"=>"$aaw[name]","flpa"=>"$aaw[pa]","logo"=>"$aaw[logo]",'fllt'=> $acc);
   }
}else{
   $sql_fi=$db->query('forum_class_fl',"`type` = '1' ORDER BY `px`",'');
   while($aaw=mysql_fetch_array($sql_fi)){
   	    if($aaw[zhank] == '1'){
        $sql_li=$db->query('forum_class'," `fid` = '$aaw[id]' and `type` = '1' ORDER BY `px`",'');
        $acc='';
        while($row_c=mysql_fetch_array($sql_li)){
	             if($row_c[logo] == '0' ){
	             	  if($row_c[tzszj] > 0 ){
	       	             $logo="images/forum/forum_new.gif";
	             	  }else{
	       	             $logo="images/forum/forum.gif";
	             	  }
	             }else{
	             	  $logo="$row_c[logo]";
	             }
	             $forum=$db->get_one('forum'," `cid` ='$row_c[id]'  ORDER BY `time_b` DESC LIMIT 0 , 1 ",'id,name');
				       $forum[name]  =Bingz_html($forum[name]);      
               $forum[name]=mb_substr($forum[name],0,13,"utf-8");
	             $acc[]= array("logo"=>"$logo","namej"=>"$row_c[value]","id"=>"$row_c[id]","name"=>"$row_c[name]","tzsz"=>"$row_c[tzsz]","hfsj"=>"$row_c[tzszj]","tzsh"=>"$row_c[tzsh]","tzst"=>"$row_c[tzst]","forumid"=>"$forum[id]","forumname"=>"$forum[name]");
        }
        }
	      $forulb[]= array("flid"=>"$aaw[id]","flname"=>"$aaw[name]","flpa"=>"$aaw[pa]","logo"=>"$aaw[logo]",'fllt'=> $acc);
   }
}
@include template('head');
@include template('forum/forum_index');
@include template('foot');
?>